<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>

    <title>Service UI Fragment</title>
    <link href="../../static/css/cas.css" rel="stylesheet" th:remove="tag"/>
</head>

<body>
    <main role="main" class="container mt-3 mb-3">
        <div th:fragment="recaptchaToken">
            <span th:if="${#strings.equalsIgnoreCase(recaptchaVersion, 'GOOGLE_RECAPTCHA_V2')}" th:remove="tag">
                <script src="//www.google.com/recaptcha/api.js"></script>
                <section id="recaptchaV2Section"
                         class="form-group"
                         th:if="${recaptchaSiteKey != null AND recaptchaInvisible != null AND !recaptchaInvisible}">
                    <div id="g-recaptcha" class="g-recaptcha" th:attr="data-sitekey=${recaptchaSiteKey}"/>

                    <script type="text/javascript"
                            th:if="${recaptchaSiteKey != null AND recaptchaInvisible != null AND recaptchaInvisible}"
                            th:inline="javascript">
                        function onRecaptchaV2Submit(token) {
                            document.getElementById('fm1').submit();
                        }
                    </script>
                </section>
            </span>
            
            <span th:if="${#strings.equalsIgnoreCase(recaptchaVersion, 'GOOGLE_RECAPTCHA_V3')}" id="recaptchaV3Section">
                <script th:src="${'//www.google.com/recaptcha/api.js?render=' + recaptchaSiteKey}"></script>
                <input type="hidden" id="g-recaptcha-token" name="g-recaptcha-token"/>

                <script type="text/javascript" th:if="${recaptchaSiteKey != null}" th:inline="javascript">
                    grecaptcha.ready(function () {
                        grecaptcha.execute(/*[[${recaptchaSiteKey}]]*/, { action: 'login' })
                            .then(function (token) {
                                $('#g-recaptcha-token').val(token);
                            });
                    });
                </script>
            </span>

            <span th:if="${#strings.equalsIgnoreCase(recaptchaVersion, 'HCAPTCHA')}" th:remove="tag">
                <script src="//hcaptcha.com/1/api.js" async defer></script>
                <section id="hcaptchaSection" class="form-group">
                    <div class="h-captcha" th:attr="data-sitekey=${recaptchaSiteKey}"></div>
                </section>
            </span>
            
            <br/>
        </div>
    </main>
</body>

</html>



